<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core">

    <body>

        <ui:composition template="./template4.xhtml">

            <ui:define name="top">
                <h:form>
                    [<h:commandLink action="#{filmController.previous}" value="Previous #{filmController.pageSize}" rendered="#{filmController.hasPreviousPage}"/>]
                    [<h:commandLink action="#{filmController.next}" value="Next #{filmController.pageSize}" rendered="#{filmController.hasNextPage}"/>]
                    <h:graphicImage url="duke.waving.gif" alt="Duke waving his hand"/>
                </h:form>
            </ui:define>

            <ui:define name="left">
                <h:form>
                    <h:dataTable value="#{filmController.filmTitles}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">  
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value=" "/>
                            </f:facet>
                            <h:commandLink action="#{filmController.prepareView}" value="#{item.title}"/>
                        </h:column>
                    </h:dataTable>
                    <br/>
                </h:form>

            </ui:define>

            <ui:define name="content">
                <h:form>
                    <h:form>
                        <h:dataTable value="#{filmController.filmTitles}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">

                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="Description"/>
                                </f:facet>
                                <h:outputText value="#{item.description}"/>
                            </h:column>

                        </h:dataTable>
                        <br/>
                    </h:form>
                </h:form>
            </ui:define>

            <ui:define name="bottom">
                <h:form>
                    <h:panelGrid columns="2">
                        <h:outputText value="Title:"/>
                        <h:outputText value="#{filmController.selected.title}" title="Title"/>
                        <h:outputText value="Description"/>
                        <h:outputText value="#{filmController.selected.description}" title="Description"/>
                        <h:outputText value="Edit Description"/>
                        <h:inputText id="description"
                                     value="#{filmController.selected.description}"
                                     title="Edit Description"
                                     maxlength="150" size="200"/>
                        <h:outputText value="Genre"/>
                        <h:outputText value="#{filmController.category}"/>

                        <h:outputText value="Cast"/>
                        <h:outputText value="#{filmController.actors}"/>
                        <h:outputText value="Film Length"/>
                        <h:outputText value="#{filmController.selected.length} min" title="Film Length"/>

                        <h:outputText value="Language"/>
                        <h:outputText value="#{filmController.language}" title="Film Length"/>

                        <h:outputText value="Release Year"/>
                        <h:outputText value="#{filmController.selected.releaseYear}" title="Release Year">
                            <f:convertDateTime pattern="MM/dd/yyyy" />
                        </h:outputText>
                        <h:outputText value="Rental Duration"/>
                        <h:outputText value="#{filmController.selected.rentalDuration}" title="Rental DUration"/>
                        <h:outputText value="Rental Rate"/>
                        <h:outputText value="#{filmController.selected.rentalRate}" title="Rental Rate"/>
                        <h:outputText value="Replacement Cost"/>
                        <h:outputText value="#{filmController.selected.replacementCost}" title="Replacement Cost"/>
                        <h:outputText value="Rating"/>
                        <h:outputText value="#{filmController.selected.rating}" title="Rating"/>
                        <h:outputText value="Special Features"/>
                        <h:outputText value="#{filmController.selected.specialFeatures}" title="Special Features"/>
                        <h:outputText value="Last Update"/>
                        <h:outputText value="#{filmController.selected.lastUpdate}" title="Last Update">
                            <f:convertDateTime pattern="MM/dd/yyyy HH:mm:ss" />
                        </h:outputText>

                    </h:panelGrid>
                    <h:panelGrid columns="2">
                        <h:inputText id="username"
                                     title="My name is: "
                                     value="#{filmController.testName}"
                                     maxlength="25" />

                        <h:outputText value="#{filmController.testMessage}" />
                    </h:panelGrid>
                    <p></p>
                    <h:commandButton id="submit" value="Submit" action="#{filmController.testAction}">
                    </h:commandButton>
                    <h:commandButton id="reset" value="Reset" type="reset">
                    </h:commandButton>

                </h:form>
            </ui:define>

        </ui:composition>

    </body>
</html>
